import 'package:flutter/material.dart';
import 'package:scaffold/controller/login/LoginController.dart';
import 'package:scaffold/state/login/LoginState.dart';
import 'package:scaffold/ui/base/BasePage.dart';
import 'package:scaffold/ui/widget/ButtonComponent.dart';
import 'package:scaffold/ui/widget/ImageComponent.dart';
import 'package:scaffold/ui/widget/InputComponent.dart';
import 'package:scaffold/ui/widget/TextComponent.dart';

class LoginPage extends BasePage<LoginController, LoginState> {
  const LoginPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: TextComponent.getText(text: 'welcome'),
      ),
      body: Column(
        children: [
          Align(
            alignment: Alignment.centerRight,
            child: ImageComponent.getImage('about'),
          ),
          InputComponent.getInput(
              model: state.nameInput,
              onObscureToggled: (){
                controller.onObscureToggled(state.nameInput);
              }
          ),
          ButtonComponent.getBtn(
              text: 'switch_lang',
              vPadding: 20,
              onPressed: controller.switchLang
          )
        ],
      ),
    );
  }
}
